<template>
  <h2>吾圈一键拉群工具</h2>
  <el-row :gutter="20">
    <el-col :span="6">
      <div class="grid-content ep-bg-purple" />
    </el-col>
    <el-col :span="12">
      <div class="grid-content ep-bg-purple" />
      <el-form label-width="auto" label-position="Right" size="large" v-if="!showcz">
        <el-form-item label="账号">
          <el-input v-model="userName" />
        </el-form-item>
        <el-form-item label="密码">
          <el-input v-model="password" type="password" />
        </el-form-item>
        <el-form-item label="服务器id">
          <el-input v-model="serverId" />
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="onSubmit" style="width: 100%;">登录</el-button>
        </el-form-item>
      </el-form>
    </el-col>
    <el-col :span="6">
      <div class="grid-content ep-bg-purple" />
    </el-col>
  </el-row>
  <el-tabs tab-position="top" style="max-height: 600px" class="demo-tabs" type="border-card" v-if="showcz">
    <el-tab-pane label="本账号好友">
      <el-form :inline="true"  class="demo-form-inline">
        <el-form-item>
          <el-button type="success" @click="getF">获取好友列表</el-button>
        </el-form-item>
        <el-form-item label="群号">
          <el-input v-model="qunhao" />
        </el-form-item>
        <el-form-item label="屏蔽用户">
          <el-input v-model="yonghuming"   placeholder="含有词名称跳过邀请"/>
        </el-form-item>
        <el-form-item >
          <el-button type="success" @click="addgr" :disabled="islaqun">一键拉群</el-button>
        </el-form-item>

      </el-form>

      <el-form :inline="true"  class="demo-form-inline">
        <el-form-item >
          <el-button type="success" @click="regr">一键踢全部人</el-button>
        </el-form-item>
        <el-form-item >
          <el-button type="success" @click="ceshi">导入用户id</el-button>
        </el-form-item>
        <el-form-item >
          <el-button type="success" @click="tijiangshi">一键踢僵尸</el-button>
        </el-form-item>
      </el-form>

      <el-dialog v-model="dialogFormVisible" title="导入用户id">
        <el-form >
          <el-form-item label="用户id" >
            <el-input
                v-model="alluserid"
                :autosize="{ minRows: 10, maxRows: 100000 }"
                type="textarea"
                placeholder="填入用户id(每行一个)"
              />
          </el-form-item>
        </el-form>
        <template #footer>
          <span class="dialog-footer">
            <el-button @click="dialogFormVisible = false">关闭</el-button>
            <el-button type="primary" @click="ceshilaren">
              确认
            </el-button>
          </span>
        </template>
      </el-dialog>
      <el-table :data="Friends" ref="singleTableRef2" id="singleTableRef" max-height="500"  border>
          <el-table-column property="profile.nick" label="好友名称" />
          <el-table-column property="userID" label="好友id" />
          <el-table-column property="status" label="拉群状态" />
      </el-table>
    </el-tab-pane>
  </el-tabs>
</template>
<script>
import axios from 'axios'
import { ElMessage } from 'element-plus'
import TencentCloudChat from '@tencentcloud/chat'
export default {
  name: 'App',
  data() {
    return {
      sizeForm: [],
      userName: '',
      serverId: '',
      password: '',
      xiazhutuo:'',
      kakaka:'',
      accid: '',
      token:'',
      accessToken:'',
      chat:null,
      groupList:[],
      xuanGroupList:[],
      showcz:false,
      yanzhengmsg:'',
      getGrouprenList:[],
      xuanzhongGrouprenlist:[],
      disabled:true,
      disabled2:true,
      qunhao:'',
      yonghuming:'',
      value1:'',
      alluserid:'',
      disabled3:true,
      disabled6:true,
      loading:false,
      loading2:false,
      Friends:[],
      xuanFriends:[],
      dialogTableVisible:false,
      dialogTableVisible2:false,
      textarea:'',
      disabled4:false,
      disabled5:true,
      file:null,
      drFriends:[],
      drxuan:[],
      userxiazhu:[],
      zhangdan:[],
      userch:[],
      xzuser:[],
      idb:null,
      dbName :'my-database',
      lsxiazhu:[],
      lsch:[],
      xiazhu1:[],
      heimingdan:'',
      lsxiazhuid:0,
      lschid:0,
      jiankongqun:[],
      chuser:[],
      search:'',
      dialogTableVisible12:false,
      dialogTableVisible10:false,
      dialogFormVisible:false,
      islaqun:false,
      demouserid:'',
      jiarenuserid:["fsT0n2ICSSaf","EY69Sx3Kn7IR","pR9A8PbFwYgN","BCsTlMlwYVOp","ifHaSpdn1IGv","rzBlHUM6krVG","K6hDn6hIMLXo","rd15iusg5caR","h7sstKAtRFDI","VZJGyjQYX4gq","4McGpKH7vsuw","TC1PBxhpBDdG","lkbsbdd3e6lr","GQoM2MN1sFrH","Au80OGIF8kC6","hOn1dnFNKmQR","i3hCgTGT8mEb","aV4v1I1Eki7Z","h8uifkGnaQ88","OQhFGjCW3F2P","XQ3c4F20QBBw","ruBEa4Uv3LhU","zjBRQW22j8gu","Dh8G3bqbwhKs","xto8ruUL2WO8","R9SGQIZo08mx","ixm7DifB6LSF","0oe7w4QRI0Z6","sXai0WjbtuP7","Pt8qOu0OM2mT","kVIdcM4J9CNo","lxEwO8EEtVOo","H3opjQVPHqXa","QU9GbVOsra3x","2BD98fDLSwTs","uZo7DrtysSQO","N76I5skNX1IK","BYPVFtTcVinL","WOLIzRKja7KW","9mG2jIGQXssY","21PxJ6z7t8mI","qXfvfe8TTaHn","JCZUGVeN4Uoj","vMvYwvYAsbwt","biKbL6WAXYZe","Yswq7XtjdaOY","4VQsmElAudJL","0R8uVureGqSn","Eylat5NbkFDZ","lFYFnEhFWwmB","Tf4NXPnMVjA8","AnR1MNoxAFwF","UYr7k0Wv4Ufk","ye7MJVRfV4mG","lZmn6FIbDGz3","snvDfa6S4WAQ","U66j0zGyAOIM","gtgbTtpmMMXs","V2TFZmMQMgrx","sIQYRJbA02BA","725J1XzLLhZi","Xa4NCnUrZnkL","Zo96sT4LHN8M","2dPzIXKaQJFp","4wH0LkIRvbsu","ONhGfus7hrcJ","4fwoVH7GC1QQ","SjMlKfVHZ0Te","a5WE8M0ESljs","dGKF3gutNWOu","ZvdbIdBETRs0","qj6aB1FC7w8R","TykOCxABtOAo","CVABHkEDNR13","UnQF3mJyYfpT","LW9PAzRpl8q5","XzauySJA2ln1","ISNO9luWLTTN","nqPxl08RBXJU","0z9C8lgqUqud","Grn4FjyXmZxa","8UAJAzx6hps2","MBHIZKJLp8FC","kptW1CVz65n6","McW1xSn5O3DA","KIk67mmFMJze","Ae4MPPuqNKNL","kcctYogoTDqO","BYBVhmlnxfnB","92tXN0Nsj7Iv","tFDl6QeOcriT","muEw4Cx4xmWC","eCJ67SGaJ4yX","5bH2xqdMpazo","A6oFr7AZgm31","oQ76nlSiZQFT","RlcEwZ5Vlp8G","KbUTIPQ6toME","Tc2KlbqIw2Qa","naO8qssohvTr","S8KjFHL6mXyl","yPAsZpLEFpVY","ttpOVBm2qr6i","9a1LHGSaHfdK","GeBWEYidoKBJ","DFZbnS7DXNdo","YYhm8gWLbVOI","ChRfDxqeahX8","5DcqpeeFSmWT","N6IJDqPgNc7c","yLdUfwUaRsro","f3vTXCmAipW4","bku1fboqcq6Q","0ehAla3xekTd","GEAxXGwCIzlv","VZ592DiBJ6Qv","yznN9k5wirB9","SsZ4RCAUoujO","uHgg38d1ebAN","NFqW8VQsMzPE","o758XneG00z5","bZAPYjjkqJjC","iMqjONK6TuiU","kWPGM88hJ87e","8YdhBDV4F6QY","Yfuhzq5yuAjd","SCqyMycAVln5","f4s2Rm3WL4ie","84ZK5uwAH6BE","WDrPuoswusUs","vZPvivo3XwCO","upDS6xRC60uM","gVRDpUNnH7uF","QAC9psd3dPep","AMpK1qYgtCNg","kQBQR6MuLkWW","Su8ODw8auHbF","PsT69w9q8Mwv","3HUsRHthK7IQ","sC83oBoV7rFM","QPbDRimET2gC","ty2kyCZTA1aP","tkz32nQ5zmpl","nZ9qJFVvdxYo","GoaMaLdBkLAW","xOPPf0Z92pJk","1gdC70w7Ogqy","Nr5Ks1JUtdSe","LVbJWuf16y26","MmjUGrASyaxL","6iD8ydcJCQJF","6ePp5dNUYKJi","EmWxP9cun0X4","xvd57GfYHslI","sQ1YsT95qNKf","50yTbOB50sQZ","SY15qNtq3H5b","VTrOh1u4TLV9","mfDE2Oh2lVIb","F1zJvzR9OQho","fnnl4dGwMofS","vbqAy2xKpTWq","9RCPsMqQk6Ju","MGXHAiW2ApRc","vkOFmGIELsBr","wu9Bal8uGQen","b1IcpqFtqNUE","aVxw0uqYxpAI","4cm22K73TuNU","Xlud4OxUbozq","UZ7nTFZDMMjl","LamTZ4hzp0Nm","CjgIKhXMCRCL","o3GxMlEqKhaG","KBOsw0JjYENH","AaQXuDn3hVSj","hnpmPvdXOfOF","YNpkRKIqssCx","3He6eZAsrioG","4Br1QSZX5Vb8","fXr97EEV2vz5","xNwY9EI3kNvy","bdcRFNAIoHeN","L0jL2uycnjL4","g8I6IFFmMP9u","aGNzP4RZv5wz","wZU38naocqti","1PZbP7VeSRDt","s7Gyyv6l4fHh","4CTflxVydh2R","e7eVSOxrnqT5","h04QLrfIubP0","h00hbLIaG6Am","2smndmrQX4vT","bhx4H6Dn5eAW","hO4qKX2fFFaa","oVrkK3FhTJq1","vmAzAuBFh6Vo","w6QatrxVdR7A","EtuY0SghdYIy","3KlV8uO8N0jV","gRN38ns6aqyO","ogdvbtjznStT","QQbLfLclznjU","jmhDADDvIUqo","fT5yrFn07HXT","1cI6TD7WQIAk","8CLLW3PjHOgm","aqpcgUOlDejD","WRqdi1qbBylo","TXDo7dvigaSw","tvTES0Tn51mH","b2ETKKsD8hak","MbYUWtR8N2GL","HR0RtcSUgRRH","GfwERovsdIzw","D7ti3tAUtB5j","8G2KYflf3uwF","m7to3rudJqXL","sjSIPJc2guEd","JXxXbsdIhccC","LSlxBNZFuUqD","GiRnIHNBxFSg","m8m5qeyVOT0n","bhOc8c4cHLde","6iG3wJF7pTW7","YFh1l3mHgctJ","lUloLtcErCyB","lSDwpEgFo9OS","JwgE1P2Egs9Y","WMSTkObVaJcz","G1XS8V7VlHOk","y4kaOIZDHEiE","HzJGTeqfYtVJ","fPZI5MeXpaaj","Cvlkqw86jF94","GKBvrnGsoO1h","soEvwsPHtxZF","ivEagaEYaAM7","bckZG5JmSQZ2","GC1p6pnJpufK","wx81c8mqC9u5","yKX0XfHt4NSm","dbIYnIz4MS3l","NntFu3EY9onr","SjTGixSVfqu6","bM9ERHH88DfA","V59Ijv9xWLF9","vCD3vwCTZlsA","PFOHpv3nN35w","O6Ic6jsIS75d","Z9h1YHjDXy2M","5gKlvpSYjYrk","Q3dxchFOZXXo","PYAy3hC0nBWF","97MEFNFE3oWH","qQS2NeWrkk2l","GUm3OUHr2AXe","JuZVZiByxPxG","EwRKTNz0CuQN","GtSigK2MEhkd","q0YxJQTmFqHD","dMVtbQqnBMbV","F8XJPoCmzGvV","oQXVX40wKqP5","0cwb8jZnLW8A","8XVpSqRhXYHj","jsStjLw3id4Z","2HPggPv4VkGW","qzOvMGrGA5A0","7fSxvr5hZ7UE","kUoCEYTv4YDJ","bCTbbmWHryNP","bxrjxnwBz2Yy","2KVqhqU8Tt4h","0scZ4csauDui","Y2gGNjp8bMoy","x4nxmsXuAzMX","g1zAhmrRcH2R","XHF4G1xatd5R","TsJ7CcIGYsvJ","1lCRmqf4dm6n","37TCWlrtuADg","LUVhn3ISRCp7","gEux5SGDWq32","tWyf7ukF8ig0","wGc8TC4JHD25","mW7XtzYSeahr","mvadFDSCXfH6","qpjaPyDS8FZH","euXDPxdwDYLc","89nvTH1CYj8L","mxCNZ0SXnhJq","K6mG9RoM1gqv","8Gh3TE2IUd0Q","YUZts8DGMo2e","WRWZKWK1tkWb","fuvLBAmViwWB","1E9dn3dKPb3W","T7NrwfHc","f5Yw8N4d","ls6gOXW1FdT5","KXJtaInT0CEo","Znj3SnjByL5N","ypMakQPDUmFJ","J1pSRIuef5Al","iKYtOofmpALZ","Npc8qYBUMx9y","0tO7tR7m0Mqt","d2BJ7bXCtonP","xlKvvY1aNQzF","VzOxcuYZpYQL","IPdK6xMLOna5","8KEAd8iO2W1L","P6Ybf7YN0cct","veww6yV5e5Rm","wuLWU4APela3","NCWyF6wha7bR","SYIbBdNRlaL3","Cs5SvihBszLa","J4n7njirifYM","hsQ2azD9NDji","IPr4yDFN2MkR","8EWykaxASvJE","rm1SMKvO0WID","qp8DWdHp3wvp","mUOWz7sDLnsR","tjuDjS5BWQnX","4S0DwUvhVeC8","028zpzMj6Wbr","fDmww85unYmZ","aIkp8geQsP8h","std0MdBmQqjS","es753QZHIEft","FmzABI1mlrzE","77VrT0Tr6b2q","kzcWJ8ZQQmLZ","sGPHyrmxMqRl","ZJ5Mx5biHMWl","OkEsuqK4mC5T","u6MHg8UrJGPg","1eBc7K29jKfp","tebMdqIXAjHG","awGL2v5tCcfd","Entv4OnEMaIp","odL6cHNIEOa6","BvREwuymYqtK","MEKL94VbNLb9","HxFg3VwCjVqJ","HWsfgsm8rSMQ","uwLmLBmPcrHQ","ZFxj0IKDf6M8","wO0MtuwVQEyW","2RXKebQuSCG6","Dv0FseagSLdk","CwvzBd6tfYXv","ZlP2N8jsan1F","st1nmR0TerG1","GiYQMTE7WE8z","gZXX47xGbJ7j","ZISKSalJLSbm","gphoAj87OQL3","otUV93mvJgN9","HvEImfb0LZGZ","Zal3i7JC9kFI","LQSPpAmJ3BQ6","qpGv9mC02NWg","9NGKGvXocCPn","ALEP8tdg6EM5","WszqUfKHGNjd","h0ryMDbufsTX","VIhHFw7dxOfu","xxaWtAGwbNEO","NbqBnHC8jsN5","FUb4wLQQM72c","CSu4eLVNy6Bl","jAEJoOIXV0r2","eud7ZEb8bwNt","KmLL9Y2kBXmH","aNBpzN9yFyOc","4bRVLpvM3wlw","RJQKX7FJRZ5t","WLii9hPymer3","xuGsN8fHgnM9","4aUdLV4vAEfQ","I1Ta28ogBny7","nPeh8vbqyTzu","JTZFno94JTD7","ORuYsIVnagP7","besZdDDsgaMj","6R0KMKRLj257","wX18NwpzgjLY","igHSEeEWmXxA","aaq96JT53FmL","TwnczKmXEAq2","AEEXvwa90znV","eAe0u177qGZS","ZPwgnoDCTcmC","8dwxFxoKfR2v","mpx27IoOlDm0","rGJRNH9Skh6G","Sc0Mb0YaMVxR","w83jun4LfDW2","Pe73HlzS55fe","5TCnlVQaPpSg","qlpOTIBkFNzA","MTqqYKe6aISL","ZYsWb9sVgnVM","zyIpeSfIrPYR","Qcnqzohq0QBR","o3Jw6iWfpJFF","Hk0vd4KsVjah","TRUvusAxajlE","wyP4jKqMUbar","GJ1gdDDpboau","LVoqtnQt4Q8N","ESJIrXKLdf5m","oeXZporn3eT7","JFQAv6M2eiXE","OZnmQOQ3BDka","0DU3tSKV1SnU","ZyAgX5ocHqoa","6h6PS6OXvO4b","GdMZ5Ibe9kGD","Ko7LPwOREeBf","kDILArBoonp6","n36g7Btq26Xa","zky5JAsHQsuE","hXllAMhwvCKz","ZxoSfOXY7T34","DDaYVOCqJZG6","7DmbtqstRgWD","0ZcVc8cnLC7l","eBT0XtKGl58R","jcVKHHBR2zEe","IgUnt0J9RiqP","nq7dYW7TQh1Q","HGTVTt1go4Kt","kKXL7IosZqCW","9qDM35JJR0Fg","wwESZBBR2Unj","6zACWy9Q5oQG","ptKS1ph1LUX6","VFsP0cW5EMvF","kK80ERvFSeHQ","6mqLs4BUtf4v","KpmdeAVcxZJQ","L4vXH56HFBru","19Sx0oHCJUpa","4pxECfwm1J6R","QndOQdfhwEUo","7WAkjrEUdxr1","TgSNVTAQBGHu","wBcM5hBdufHI","1gWvDNHFjjKl","6ZLpBcMJ5Cdq","jZ7SHoLpiS8a","MBwNPbt41GbZ","0XYL2KrcNmD3","pzjqmX6sNM7d","BypL45eoAyCC","qs4r47CkbUUc","3bnMPRG2Qfkz","lR9ym7yWIK00","t9zerEIv70EK","ayxcKD6EvAoS","7lxc0cJY4AkC","jHiDpxUWkgba","oHZ3ZbEm8y76","H6rAdzm7L5CN","b2IgB1KvLv50","J05Iwp4IxPcw","9K8aaQLljIHI","L1HxdKuzAr3r","PHH6M3VOpT7l","ZUtaQFK7XsZ4","xH0vhaSZiTHX","ETpd6FeKXFsT","jUt091alpBPg","uA78TJmUl5jy","uprSakUMHHN2","cdvqbWg6rZch","ZlfyPR9hLzfH","8UXmPK2skYOT","qsXN5TEB1ypA","C6V92FjPHY8N","VgqD4eA82f5l","mz9a4H8JwT5X","YK2nDhrRmwLE","g4Ij1S6j4ttq","qDlGagUTiqhx","3Df6WVSInf5n","2FbFFqH0boQY","1YbKWz9IN7sM","G9UQlW1WQnZN","8Eupz7PB7wRz","AnZqdEx7ekao","bZSXsGXUYhVK","9rEr2bKwcy9g","5JPYlxphyGzI","uXs1jD8lAbeP","myJxj7LWVRUN","w95JkatrtAkB","KVCRaW9OUXO8","OcYKDIUhwar9","78N7ps79FtFc","ykl7RBfkAFUZ","nFM2V3CxVmso","Kbt8jyR138u4","3sbfewpYXQOu","sxYwX6Rg6DrE","8XILNwakTzjI","IEKLV7TfzhvT","7OQdnzKfpeBr","PEZTH41ubLfU","g9flFp2NKnEC","0DpSqYJIorMk","4uuOslFOluNs","iLGUihaibBrM","2k6Mxfk0M8Ze","gcY9kOMOMHwA","dE1uuZat5fFy","eKhDObYPpCrR","LWL5tUg4xpRr","96HADzzrcolN","Cfiusl8Ftcxa","MafZ3kSdtcqV","0k5HVCWmVmAg","mdbNrDwNfGb0","E5DGGm9LxPHg","zru22ftr13xj","GguDmj5IEhDw","k0C3EjHIjCoI","UuUezfCx9ZG9","JnQYR5HqAOeN","HP4XrqovoF1L","obiCnJy5m6gL","SfrdbIvYuHbp","muxRqNxIzbmE","hihylR6C3Pxc","6gYLhRjn0NQB","wVcjPuwPOzOf","SSQFy6X0oMpj","bcxcF3ao2g2c","GU2VSNScm177","83PPljSwSdP0","YiAOUDbyJmoA","EwFJqZhlOjT4","MiMY0QELJh78","DVbVedWm1p2J","nJTJgYJoABhG","Ps5f5O5NAqgZ","IWbhavehC80D","Gokt221mzz8B","dg5oCnCEtefx","fbPZseRem3X0","U07VUqdkOJdI","0Iua1QT3aN3c","n4eZnnU4zL1J","AdDXoaLbTqec","SGUIJdeQ1tcp","G0uEoUsFnpvF","58zQ2v37rwT7","QNMr0jvE3V7G","v9cRgha8Ryo7","dbPpjkOuLhVy","sWLExwMj4i5v","IKmNSkWUZzvZ","AD2agQFWQev7","Jegiwa24G06b","0Ui912eZkJ0H","hhf9NQCGzduo","CbwUEIpj7vbu","1HJ9farUoFZc","bJOcvMfgT0cy","gbMs23j7QhWo","ix66yO7ISy1l","V2wZg4rl7hJb","PxPafHx2a8Fv","tg9Za2taxMuu","PbfEZBYRfGyS","31JpvxNpj6KR","SUqkC05HewVW","tqN1nQnuRPN0","itefM0881Slt","8fkIbQScJsbU","NOIHtOT4UPm7","qCwlLXJMuIoc","U5wmqrnOzq6o","K2WxyDDr8","AUKFwVgPW","18I84bvgY","Ct6v2h3WS","JZNP52Pdj","oqW1T0EhM","OzDaEKEVV","lxcQjHrgS","qFGLzIr8i","VM0NP3uQ6","67UJAYPhW","vQIO21FoJ","1QS5herY3","XxLsYuIvd","Bw8nnyjLF","Q6mM2Bw37","9h23wb4pY","COmL8G7d6","v0E0giu2v","zlBXSfW25","ZrwfBiYly","OanS2sfxd","K5FzqU3CE","fG56fUzdn","NTRnzugi8","rtfHNlW4H","wISidqALB","CjvC5PGsq","JGVM4MWoL","5dSyvhxpc","sARz2vNrY","nMWtErCAd","Z7UayLHt0","aUIjLeakZ","RBZXAyu2q","flqiQPtiM","Id23l9WE6","MITygIR5q","VLyDq9RKG","osAE59xqz","5drPYBFgJ","Wd1JAuW6U","sso6shS1S","N1TM6ZtNA","kNyNHlSor","2M5FFPLt1","XSmaU6vFT"],
    }
  },
  components: {
    
  },
  updated(){

  },
  computed:{
  },
  created(){
    let userName =  localStorage.getItem('userName')
    if(userName){
      this.userName = JSON.parse(userName)
    }else{
      this.userName = []
    }
    let password = localStorage.getItem('password')
    if(password){
      this.password = password
    }else{
      this.password =''
    }
  },
  watch: {
  },
  mounted() {
  },
  methods: {
   async tijiangshi(){
    if(!this.qunhao){
        ElMessage({
          message: '请输入群号',
          type: 'error',
        })
        return false
      }
      for(let i = 0;i<this.jiarenuserid.length;i += 50){
        let output=[]
        output = this.jiarenuserid.slice(i, i + 50);
        let promise = this.chat.deleteGroupMember({
          groupID:this.qunhao,
          userIDList:output,
          reason: '我要踢你！',
        });
        promise.then(function(imResponse) {
          console.log(imResponse.data.group); // 删除后的群组信息
          console.log(imResponse.data.userIDList); // 被删除的群成员的 userID 列表
        }).catch(function(imError) {
            console.warn('deleteGroupMember error:', imError); // 错误信息
        });
      }
      ElMessage({
          message: '踢出僵尸成功',
          type: 'success',
      })
    },
    ceshilaren(){
      this.Friends = []
      this.dialogFormVisible=false
      let lines = this.alluserid.split(/\r?\n/).map(line => line.trim())
      lines.forEach(list=>{
        this.Friends.push({
          userID:list,
          status:'',
          profile:{
            nick:'不是好友'
          }
        })
      })
    },
    async getqiandao(qunid){
      return new Promise((resolve)=>{
        let menumlist = []
        for(let i = 0;i<parseInt(6000/100);i++){
          let promise =  this.chat.getGroupMemberList({
          groupID: qunid,
          count: 100,
          offset:i*100,
          role:TencentCloudChat.TYPES.GRP_MBR_ROLE_MEMBER
          }); 
          promise.then((imResponse)=> {
            imResponse.data.memberList.forEach(list=>{
              menumlist.push(list.userID)
              let promise = this.chat.deleteGroupMember({
                groupID:this.qunhao,
                userIDList:[list.userID],
                reason: '我要踢你！',
              });
              promise.then(function(imResponse) {
                console.log(imResponse.data.group); // 删除后的群组信息
                console.log(imResponse.data.userIDList); // 被删除的群成员的 userID 列表
              }).catch(function(imError) {
                console.warn('deleteGroupMember error:', imError); // 错误信息
              });
            })
          }).catch((imError)=> {
            console.warn('getGroupMemberList error:', imError);
          });
        }
        ElMessage({
          message: '踢出全部人成功',
          type: 'success',
        })
        resolve(menumlist)
      })
    },
    async getnum(qunid){
      try{
        const data = await this.getqiandao(qunid)
        return data;
      } catch(err){
        console.log(err)
      }
    },
    async regr(){
      if(!this.qunhao){
        ElMessage({
          message: '请输入群号',
          type: 'error',
        })
        return false
      }
      this.getnum(this.qunhao).then(res=>{
        console.log(res)
      })
    },
    ceshi(){
      this.dialogFormVisible = true
    },
    async addgr(){
      if(!this.qunhao){
        ElMessage({
          message: '请输入群号',
          type: 'error',
        })
        return false
      }
      
      let tid = this.qunhao
      if(!this.yonghuming){
        // 全部要
        let memberList=[]
        this.Friends.forEach(list=>{
          memberList.push(list.userID)
        })
        let promises = this.chat.updateGroupProfile({
          groupID: tid,
          // 群成员能收到群自定义字段变更的群提示消息，且能获取到相关的内容，
          // 详见 Message.payload.newGroupProfile.groupCustomField
          inviteOption:TencentCloudChat.TYPES.INVITE_OPTIONS_NEED_PERMISSION
        });
        promises.then((imResponse)=> {
          console.log(imResponse.data.group) // 修改成功后的群组详细资料
        }).catch((imError)=> {
          console.warn('updateGroupProfile error:', imError); // 修改群组资料失败的相关信息
        });
        for (let i = 0; i < memberList.length; i += 10) {
            let output=[]
            output = memberList.slice(i, i + 10);
            let promise = this.chat.addGroupMember({groupID: tid, userIDList: output});
            promise.then((imResponse) =>{
              imResponse.data.successUserIDList.forEach(item=>{
                this.Friends = this.Friends.map(list => list.userID === item ? { ...list, status: "成功" } : list)
              })
              imResponse.data.failureUserIDList.forEach(item=>{
                this.Friends = this.Friends.map(list => list.userID === item ? { ...list, status: "失败" } : list)
              })
              imResponse.data.existedUserIDList.forEach(item=>{
                this.Friends = this.Friends.map(list => list.userID === item ? { ...list, status: "已在群中" } : list)
              })
            }).catch((imError) =>{
              console.warn('addGroupMember error:', imError); // 错误信息
            });
        }
      }else{
        // 不为空
        // 跳过
        let memberList = []
        this.Friends.forEach(list=>{
          if(!list.profile.nick.includes(this.yonghuming)){
            memberList.push(list.userID)
          }else{
            list.status='跳过'
          }
        })
        let promises = this.chat.updateGroupProfile({
          groupID: tid,
          // 群成员能收到群自定义字段变更的群提示消息，且能获取到相关的内容，
          // 详见 Message.payload.newGroupProfile.groupCustomField
          inviteOption:TencentCloudChat.TYPES.INVITE_OPTIONS_NEED_PERMISSION
        });
        promises.then((imResponse)=> {
          console.log(imResponse.data.group) // 修改成功后的群组详细资料
        }).catch((imError)=> {
          console.warn('updateGroupProfile error:', imError); // 修改群组资料失败的相关信息
        });
        for (let i = 0; i < memberList.length; i += 10) {
            let output=[]
            output = memberList.slice(i, i + 10);
            let promise = this.chat.addGroupMember({groupID: tid, userIDList: output});
            promise.then((imResponse) =>{
              imResponse.data.successUserIDList.forEach(item=>{
                this.Friends = this.Friends.map(list => list.userID === item ? { ...list, status: "成功" } : list)
              })
              imResponse.data.failureUserIDList.forEach(item=>{
                this.Friends = this.Friends.map(list => list.userID === item ? { ...list, status: "失败" } : list)
              })
              imResponse.data.existedUserIDList.forEach(item=>{
                this.Friends = this.Friends.map(list => list.userID === item ? { ...list, status: "已在群中" } : list)
              })
            }).catch((imError) =>{
              console.warn('addGroupMember error:', imError); // 错误信息
            });
        }
        
      }

    },
    getF(){
      this.Friends=[]
      let promise = this.chat.getFriendList();
      promise.then((imResponse)=> {
        ElMessage({
          message: '获取好友列表成功',
          type: 'success',
        })
        imResponse.data.forEach(list=>{
          this.Friends.push({
            userID:list.userID,
            status:'',
            profile:{
              nick:list.profile.nick
            }
          })
        })
      }).catch(()=> {
        ElMessage({
          message: '获取好友列表失败，请重试',
          type: 'error',
        })
      });
    },
    onSubmit() {
      // 登录
        let data = {
          password: this.password,
          serverId: this.serverId,
          userName: this.userName
        }
        let login = axios.create({
          baseURL: 'https://api.ts28.com.cn/',
          timeout: 5000, // 请求超时时间
        })
        login.post('/wqlogin', data).then(res => {
          if (res.data.code == 200) {
            //登录成功
            ElMessage({
              message: res.data.msg,
              type: 'success',
            })
            this.accid = res.data.data.accid
            this.toekn = res.data.data.token
            this.imappid = parseInt(res.data.data.imAppid)
            this.accessToken =  res.data.data.access_token
            // 登录腾讯im
            let options = {
              SDKAppID: parseInt(res.data.data.imAppid)
            }
            this.chat = TencentCloudChat.create(options);
            let promise = this.chat.login({ userID: res.data.data.accid, userSig: res.data.data.token });
            promise.then((imResponse) => {
              ElMessage({
                message: '连接服务器成功',
                type: 'success',
              })
              setTimeout(() => {
                this.getF()
                this.showcz = true
                localStorage.setItem('userName', JSON.stringify(this.userName))
                localStorage.setItem('password', this.password)
              }, 1000)
              if (imResponse.data.repeatLogin === true) {
                // 标识账号已登录，本次登录操作为重复登录。
                console.log(imResponse.data.errorInfo);
                ElMessage({
                  message: '重复登录，请退出其他页面登录后再试',
                  type: 'error',
                })
              }
            }).catch((imError) => {
              console.log(imError)
              ElMessage({
                message: '连接服务器失败请重试',
                type: 'error',
              })
            });
          } else {
            //登录失败
            ElMessage({
              message: res.data.msg,
              type: 'error',
            })
          }
        }).catch(err => {
          console.log(err)
        })
      }
    },
    // 接收消息
}
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  width: 80%;
  margin: 0 auto;
}

.demo-tabs .el-tabs__content {
  padding: 32px;
  color: #6b778c;
  font-size: 32px;
  font-weight: 600;
}
.el-table{
  display: flex;
  flex-direction: column;
}
.el-table__body-wrapper {
  order: 1;
}
</style>

